import 'package:bloc/bloc.dart';
import 'package:drm/util/utils.dart';


class VersionEvent {

  Future<String> getVersion() async {
    return MyUtils.getNowAppVerCode();
  }

}

class VersionState {
  String version;

  VersionState(this.version);

}


class VersionBloc extends Bloc<VersionEvent,VersionState> {

  @override
  VersionState get initialState {
     return VersionState('');
  }

  @override
  Stream<VersionState> mapEventToState(VersionEvent event)  async* {
    if (event is VersionEvent) {
      yield VersionState(await event.getVersion());
    }
  }
}